home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_jeep_pyr.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  163 lines

  1. # Jones 3D Cog Script
  2. #
  3. # Jeep_pyr.cog
  4. #
  5. # [PKM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13.     message        startup
  14.     message        created
  15.     message        activated
  16.     message        callback
  17.  
  18.     sound        someGas=INXJ243.wav                    local
  19.     sound        gasCanOn=jep_gascan_attach.wav        local
  20.     sound        gasCanOff=jep_gascan_detach.wav        local
  21.  
  22.     thing        jeep                                local
  23.     thing        indy                                local
  24.  
  25.     int            jeepMesh                            local
  26.     int            meshRef                                local
  27.     int            gasCanBin=66                        local
  28.     int            isTakingCan=0                        local
  29.     int            bStartCutscene=0                    local
  30.  
  31.     flex        dotProduct                            local
  32.     flex        rightDot                            local
  33.  
  34.     vector        indyVector                            local
  35.     vector        cameraPos                            local
  36.  
  37.     model        jeepGasCan=gascan_pyr_jeep.3do        local
  38.  
  39.     keyframe    in_reach=in_pickup_med.key            local
  40.  
  41. end
  42.  
  43. # ========================================================================================
  44.  
  45. code
  46.  
  47. startup:
  48.  
  49.     indy = GetLocalPlayerThing();
  50.     return;
  51.  
  52. created:
  53.     jeep = GetSenderRef();
  54.     jeepMesh = GetMeshByName(jeep, "jeep_body");
  55.     meshRef = SetThingMesh(jeep, jeepMesh, jeepGasCan, 0);
  56.  
  57.     SetThingUserData(jeep, meshRef);
  58.     return;
  59.  
  60. activated:
  61.     indyVector = VectorNorm(VectorSub(GetThingPos(jeep), GetThingPos(indy)));
  62.  
  63.     # Check to see where Indy is standing relative to the jeep
  64.     dotProduct = VectorDot(GetThingLVec(jeep), indyVector);
  65.     rightDot = VectorDot(GetThingRVec(jeep), indyVector);
  66.  
  67.     # Check to see if Indy is positioned near the gas can.
  68.     if ((dotProduct >= 0.904) && (dotProduct <= 0.997) && (rightDot > 0))
  69.     {
  70.         meshRef = GetThingUserData(jeep);
  71.  
  72.         # The player has activated the jeep near the gas can bracket.
  73.         if (meshRef == -1)
  74.         {
  75.             if (GetCurItem(indy) == gasCanBin)
  76.             {
  77.                 isTakingCan = 0;
  78.                 bStartCutscene = 1;
  79.  
  80.                 SendMessage(GetCogByIndex(0), user1);
  81.             }
  82.         }
  83.         else
  84.         {
  85.             isTakingCan = 1;
  86.             bStartCutscene = 1;
  87.  
  88.             SendMessage(GetCogByIndex(0), user0);
  89.         }
  90.     }
  91.  
  92.     if (bStartCutscene)
  93.     {
  94.         if (MakeMeStop() == -1)
  95.         {
  96.             bStartCutscene = 0;
  97.             return;
  98.         }
  99.         # RT: Fixed bug #7626
  100.         DeselectWeaponWait(indy);
  101.  
  102.         SetExtCamOffset('0.2 0.1 0.1');
  103.  
  104.         # RT: Also forgot to start the cutscene
  105.         StartCutscene(0);
  106.  
  107.         # RT: Now it's okay to capture indy
  108.         CaptureThing(indy);
  109.         PlayKey(indy, in_reach, 5, 0x12, 0); 
  110.         bStartCutscene = 0;
  111.     }
  112.  
  113.     return;
  114.  
  115. callback:
  116.     if (GetParam(1) == 16)
  117.     {
  118.         # Indy is halfway through with his reach animation, so take the can off the jeep, or
  119.         # put it back, as appropriate.
  120.  
  121.         meshRef = GetThingUserData(jeep);
  122.  
  123.         ReleaseThing(indy);
  124.         if (isTakingCan == 1)
  125.         {
  126.             # The gas can is currently attached to the jeep - give it to the player.
  127.  
  128.             RestoreThingMesh(jeep, meshRef);
  129.             SetThingUserData(jeep, -1);
  130.             PlaySoundLocal(gasCanOn, 1.0, 0, 0, 0);
  131.  
  132.             SetInvAvailable(indy, gasCanBin, 1);
  133.             ChangeInv(indy, gasCanBin, 1.0);
  134.             JonesInvItemChanged(gasCanBin);            
  135.  
  136.             SendMessage(GetThingCaptureCog(jeep), user0);
  137.  
  138.             Sleep(1.0);
  139.             PlayVoice(indy, someGas, 1.0, 0);
  140.         }
  141.         else
  142.         {
  143.             # The player is activating us with the gas can - put it back on the jeep.
  144.             jeepMesh = GetMeshByName(jeep, "jeep_body");
  145.             meshRef = SetThingMesh(jeep, jeepMesh, jeepGasCan, 0);
  146.             PlaySoundLocal(gasCanOff, 1.0, 0, 0, 0);
  147.  
  148.             SetThingUserData(jeep, meshRef);
  149.  
  150.             ChangeInv(indy, gasCanBin, -1.0);
  151.             SetInvAvailable(indy, gasCanBin, 0);
  152.  
  153.             SendMessage(GetThingCaptureCog(jeep), user1);
  154.         }
  155.     }
  156.  
  157.     RestoreExtCam();
  158.     ClearActorFlags(indy, 0x200000);
  159.     EndCutscene();
  160.  
  161.     return;
  162. end
  163.